#include "Base.h"

Base::Base(int _x, int _y, int _maxHp, CImage* _imageList[3])
{
	x = _x;
	y = _y;
	maxHp = _maxHp;
	hp = _maxHp;
	for (int i = 0; i < 3; i++)
	{
		imageList[i] = _imageList[i];
	}
	isAlive = true;
	curImg = 0;
	image = *imageList[curImg];
}

void Base::update(CDC* mdc)
{
	drawImage(mdc);
}

bool Base::IsAlive()
{
	return isAlive;
}

void Base::UnderAttack(int damage)
{
	hp -= damage;
	if (hp <= 0) {
		hp = 0;
		isAlive = false;
	}
}

void Base::UpdateAge(int _maxHp)
{
	int deltaHp = maxHp - hp;
	maxHp = _maxHp;
	hp = maxHp - deltaHp;
	curImg++;
	image = *imageList[curImg];
}

int Base::GetMaxHp()
{
	return maxHp;
}

int Base::GetHp()
{
	return hp;
}

int Base::GetWidth()
{
	return 200;
}

